<div class="top-fixed">
    <div class="navbar" style="max-width: 640px;margin: auto;">
        <div class="navbar-inner">
            <div class="left">
                <a href="javascript:history.back();" class=""><i class="fa fa-angle-left" style="font-size: 30px;"></i></a>
            </div>
            <div class="center">合伙人订单</div>
            <div class="right">
                <a href="/" class=""><i class="fa fa-home"></i></a>
            </div>
        </div>
    </div>
</div>
<section class="main" style="max-width: 640px;margin: auto;">
    <div id="status-filter" class="table bgf tc fs14 order_nav">
        <a href="/partner_orders" data-value="All"
           class="table-cell {{#if_eq query.type 'jd'}}{{^}}active{{/if_eq}}">
            <span class="hint-num">淘宝天猫订单</span>
        </a>
        <a href="/partner_orders?type=jd" data-value="Active"
           class="table-cell {{#if_eq query.type 'jd'}}active{{/if_eq}}">
            <span class="hint-num">京东订单</span>
        </a>
    </div>
    <div id="status-filter" class="table bgf tc fs14 order_nav">
        <a href="/partner_orders?status=All&agency_id={{query.agency_id}}&type={{query.type}}" data-value="All"
           class="table-cell {{#if_eq query.status 'All'}}active{{/if_eq}}">
            <span class="hint-num">所有订单</span>
        </a>
        <a href="/partner_orders?status=Active&agency_id={{query.agency_id}}&type={{query.type}}" data-value="Active"
           class="table-cell {{#if_eq query.status 'Active'}}active{{/if_eq}}">
            <span class="hint-num">有效订单</span>
        </a>
        <a href="/partner_orders?status=Settle&agency_id={{query.agency_id}}&type={{query.type}}" data-value="Settle"
           class="table-cell {{#if_eq query.status 'Settle'}}active{{/if_eq}}">
            <span class="hint-num">结算订单</span>
        </a>
        <a href="/partner_orders?status=Deactivated&agency_id={{query.agency_id}}&type={{query.type}}"
           data-value="Deactivated"
           class="table-cell {{#if_eq query.status 'Deactivated'}}active{{/if_eq}}">
            <span class="hint-num">无效订单</span>
        </a>
    </div>
    <div class="weui_search_bar" id="search_bar">
        <form class="weui_search_outer" id="search_form" method="get" action="/partner_orders">
            <div class="weui_search_inner">
                <i class="weui_icon_search"></i>
                <input type="search" class="weui_search_input" id="search_input" name="keyword"
                       placeholder="搜索订单编号"
                       required value="{{query.keyword}}"/>
                <a href="javascript:" class="weui_icon_clear" id="search_clear"></a>
            </div>
            <label for="search_input" class="weui_search_text" id="search_text">
                <i class="weui_icon_search"></i>
                <span>搜索订单编号</span>
            </label>
        </form>
        <a href="javascript:" class="weui_search_cancel" id="search_cancel">取消</a>
    </div>
    <div style="color: #FC6D84; text-align: center; line-height: 30px; font-size: 14px; background: #fff;">
        数据有几分钟延时，如果数据没有显示，请过几分钟再试
    </div>
    <ul class="contact_con fs12">
        {{#if_eq query.type 'jd'}}
            {{#if rows}}
                <ul class="list-wrapper">
                    {{#each rows}}
                        <li class="bb">
                            {{#each skus}}
                                <dl class="table ptb10 plr10">
                                    <dd class="table-cell vm">
                                        <p class="col3 single-line"><a
                                                href="http://item.jd.com/{{skuId}}.html">{{skuName}}</a>
                                        </p>
                                        <p style="color: #FA6E28;">{{../orderStatusName}}</p>
                                    </dd>
                                </dl>
                            {{/each}}

                            <div class="table">
                                <dd class="table-cell vm p10">
                                    <p class="col3 single-line">付款金额</p>
                                    <p class="col3">￥{{cosPrice}}</p>
                                </dd>
                                <dd class="table-cell vm p10 tc">
                                    <p class="col3 single-line">预估收入</p>
                                    <p class="col3">￥{{commission}}</p>
                                </dd>
                                <dd class="table-cell vm p10 tr">
                                    <p class="col3 single-line">返现状态</p>
                                    <p class="col3 red">{{amount_status}}</p>
                                </dd>
                            </div>
                            <div class="table">
                                <dd class="table-cell vm p10">
                                    <p class="col3 single-line">返(用户/邀请)</p>
                                    <p class="col3">￥{{or pay_amount '0'}}/{{or inviter_pay_amount '0'}}</p>
                                </dd>
                                <dd class="table-cell vm p10 tc">
                                    <p class="col3 single-line">佣(代理/上级)</p>
                                    <p class="col3">￥{{or agency_amount '0'}}/{{or inviter_agency_amount '0'}}</p>
                                </dd>
                                <dd class="table-cell vm p10 tr">
                                    <p class="col3 single-line">预计收入</p>
                                    <p class="col3 red">￥{{or income '0'}}</p>
                                </dd>
                            </div>

                            {{#if user}}
                                <dl class="table ptb10">
                                    <dt class="table-cell vm w60 plr10">
                                        <div class="br50 item-pic">
                                            {{#if user.image}}
                                                <img src="{{user.image}}?imageView2/1/w/150/h/150/q/75" class="imgm">
                                            {{^}}
                                                <img src="images/default-none-head.png" class="imgm">
                                            {{/if}}
                                        </div>
                                    </dt>
                                    <dd class="table-cell vm">
                                        <a href="/partner_orders?user_id={{user.id}}"
                                           class="col3 single-line">{{user.nickname}} 「ID:{{user.id}}」</a>
                                        <p class="single-line">
                                            订单数:
                                            <a href="/partner_orders?user_id={{user.id}}" class="green">
                                                {{user.order_count}}/{{user.finish_count}}/{{user.sham_count}}
                                            </a>&nbsp;&nbsp;&nbsp;&nbsp;
                                            金额:
                                            <a href="/user_finances?user_id={{user.id}}" class="green">
                                                {{user.amount}}/{{user.frozen}}
                                            </a>
                                        </p>
                                    </dd>
                                    <dt class="table-cell vm plr10 item-rt">
                                        <span class="tc col9 call">用户</span>
                                    </dt>
                                </dl>
                            {{/if}}

                            <div class="table">
                                <dd class="table-cell vm p10">
                                    <p class="col6">{{orderId}}</p>
                                </dd>
                                <dd class="table-cell vm p10">
                                    <p class="col6">{{format_datetime orderDate}} 创建</p>
                                </dd>
                            </div>
                        </li>
                    {{/each}}
                </ul>
            {{^}}
                <div class="tc nothing">
                    <span class="mt10 fs14 col9">晳时还没有订单！</span>
                </div>
            {{/if}}
        {{^}}
            {{#if rows}}
                <ul class="list-wrapper">
                    {{#each rows}}
                        <li class="bb">
                            <dl class="table ptb10">
                                {{#if pictUrl}}
                                    <dt class="table-cell vm w70 plr10">
                                        <div class="br5 item-pic">
                                            <a href="/detail?id={{auctionId}}"><img src="{{pictUrl}}" class="imgm"></a>
                                        </div>
                                    </dt>
                                {{/if}}
                                <dd class="table-cell vm">
                                    <p class="col3 single-line"><a href="/detail?id={{auctionId}}">{{auctionTitle}}</a>
                                    </p>
                                    <p class="col3">所属店铺：{{exShopTitle}}</p>
                                    <p>
                                        <span style="color: #FA6E28;">{{payStatus}}</span>
                                        {{#if agency_settle_id}}
                                            <a href="/partner_orders?agency_settle_id={{agency_settle_id}}"
                                               class="blue">「结算编号:{{agency_settle_id}}」</a>{{/if}}
                                    </p>
                                </dd>
                            </dl>

                            <div class="table">
                                <dd class="table-cell vm p10">
                                    <p class="col3 single-line">付款金额</p>
                                    <p class="col3">￥{{totalAlipayFeeString}}</p>
                                </dd>
                                <dd class="table-cell vm p10 tc">
                                    <p class="col3 single-line">预估收入</p>
                                    <p class="col3">￥{{feeString}}/{{discountAndSubsidyToString}}%</p>
                                </dd>
                                <dd class="table-cell vm p10 tr">
                                    <p class="col3 single-line">返现状态</p>
                                    <p class="col3 red">{{amount_status}}</p>
                                </dd>
                            </div>
                            <div class="table">
                                <dd class="table-cell vm p10">
                                    <p class="col3 single-line">返(用户/邀请)</p>
                                    <p class="col3">￥{{or pay_amount '0'}}/{{or inviter_pay_amount '0'}}</p>
                                </dd>
                                <dd class="table-cell vm p10 tc">
                                    <p class="col3 single-line">佣(代理/上级)</p>
                                    <p class="col3">￥{{or agency_amount '0'}}/{{or inviter_agency_amount '0'}}</p>
                                </dd>
                                <dd class="table-cell vm p10 tr">
                                    <p class="col3 single-line">预计收入</p>
                                    <p class="col3 red">￥{{or income '0'}}</p>
                                </dd>
                            </div>

                            {{#if pay_amount}}
                                {{#if user_id}}
                                    <div class="table partner-opt" data-id="{{id}}">
                                        {{#if hasPayed}}
                                            <dd class="table-cell vm p10">
                                                <a href="javascript:;" opt="payed" opt-title="确认返款"
                                                   opt-desc="确认已经给用户转账？该操作会从用户账号中扣款."
                                                   class="br3 bgf btn-mini btn-mini_outlined">确认返款</a>
                                            </dd>
                                        {{/if}}
                                        <dd class="table-cell vm p10 tr">
                                            {{#unless is_back}}
                                                <a href="javascript:;" opt="back" opt-title="无效"
                                                   opt-desc="确认订单无效？该操作会从用户账号中扣款"
                                                   class="mr5 br3 btn-mini btn-mini_black bgf">无效</a>
                                            {{/unless}}
                                            {{#if is_sham}}
                                                <a href="javascript:;" opt="cancel_sham" opt-title="取消欺诈"
                                                   opt-desc="确认取消欺诈？"
                                                   class="mr5 br3 btn-mini btn-mini_black bgf">取消欺诈</a>
                                            {{^}}
                                                <a href="javascript:;" opt="sham" opt-title="欺诈" opt-desc="确认订单属于欺诈？"
                                                   class="mr5 br3 btn-mini btn-mini_black bgf">欺诈</a>
                                            {{/if}}
                                        </dd>
                                    </div>
                                {{/if}}
                            {{/if}}

                            {{#if user}}
                                <dl class="table ptb10">
                                    <dt class="table-cell vm w60 plr10">
                                        <div class="br50 item-pic">
                                            {{#if user.image}}
                                                <img src="{{user.image}}?imageView2/1/w/150/h/150/q/75" class="imgm">
                                            {{^}}
                                                <img src="images/default-none-head.png" class="imgm">
                                            {{/if}}
                                        </div>
                                    </dt>
                                    <dd class="table-cell vm">
                                        <a href="/partner_orders?user_id={{user.id}}"
                                           class="col3 single-line">{{user.nickname}} 「ID:{{user.id}}」</a>
                                        <p class="single-line">
                                            订单数:
                                            <a href="/partner_orders?user_id={{user.id}}" class="green">
                                                {{user.order_count}}/{{user.finish_count}}/{{user.sham_count}}
                                            </a>&nbsp;&nbsp;&nbsp;&nbsp;
                                            金额:
                                            <a href="/user_finances?user_id={{user.id}}" class="green">
                                                {{user.amount}}/{{user.frozen}}
                                            </a>
                                        </p>
                                    </dd>
                                    <dt class="table-cell vm plr10 item-rt">
                                        <span class="tc col9 call">用户</span>
                                    </dt>
                                </dl>
                            {{/if}}

                            {{#if agency}}
                                <dl class="table ptb10">
                                    <dt class="table-cell vm w60 plr10">
                                        <a href="/partner_agency?id={{agency.id}}" class="br50 item-pic"
                                           style="display: block;">
                                            {{#if agency.image}}
                                                <img src="{{agency.image}}?imageView2/1/w/150/h/150/q/75" class="imgm">
                                            {{^}}
                                                <img src="images/default-none-head.png" class="imgm">
                                            {{/if}}
                                        </a>
                                    </dt>
                                    <dd class="table-cell vm">
                                        <a href="/partner_agency?id={{agency.id}}"
                                           class="col3 single-line">{{agency.nickname}} 「ID:{{agency.id}}」</a>
                                        <a href="/partner_orders?agency_id={{agency.id}}"
                                           class="green single-line">{{mediumName}} {{adPositionName}}</a>
                                    </dd>
                                    <dt class="table-cell vm plr10 item-rt">
                                        <span class="tc col9 call">代理</span>
                                    </dt>
                                </dl>
                            {{^}}
                                <dl class="table ptb10">
                                    <dt class="table-cell vm w60 plr10">
                                        <a href="/partner_orders?mediumId={{mediumId}}&adPositionId={{adPositionId}}"
                                           class="green single-line">{{mediumName}} {{adPositionName}}</a>
                                    </dt>
                                </dl>
                            {{/if}}

                            <div class="table">
                                <dd class="table-cell vm p10">
                                    <p class="col6">{{taobaoTradeParentId}}</p>
                                </dd>
                                <dd class="table-cell vm p10 tr">
                                    <a href="/last_visitors?goods_id={{auctionId}}" class="blue ">商品最近浏览</a>
                                </dd>
                            </div>
                            <div class="table">
                                <dd class="table-cell vm p10">
                                    <p class="col6">{{format_datetime createTime}} 创建</p>
                                </dd>
                                {{#if earningTime}}
                                    <dd class="table-cell vm p10 tr">
                                        <p class="col6">{{format_datetime earningTime}} 结算</p>
                                    </dd>
                                {{/if}}
                            </div>
                        </li>
                    {{/each}}
                </ul>

                <div class="loadmore-wrapper loadmore" style="margin: 10px;">
                    {{#if loadmore}}
                        <div class="weui-infinite-scroll">
                            <div class="infinite-preloader"></div>
                            正在加载...
                        </div>
                    {{/if}}
                </div>
            {{^}}
                <div class="tc nothing">
                    <span class="mt10 fs14 col9">晳时还没有订单！</span>
                </div>
            {{/if}}
        {{/if_eq}}
        </div>
</section>